/*! \file HXUtil.h
    \brief Utility functions and classes for Head X.

	Head X | Flinders University | Martin Luerssen & Trent Lewis | 2009+
*/

#pragma once

class HXStopWatch;

#include "stdafx.h"
using namespace std;

#include "HXViseme.h"

//-----------------------------------------------------------------------------
// STOPWATCH

typedef struct 
{
    LARGE_INTEGER start;
    LARGE_INTEGER stop;
} stopWatch;

class HXStopWatch 
{
public:
    HXStopWatch();
    void startTimer();
    void stopTimer();
    double getElapsedTime();
	float getElapsedTimeF();
private:
    stopWatch timer;
    LARGE_INTEGER frequency;
    double LIToSecs(LARGE_INTEGER & L);
	float LIToSecsF(LARGE_INTEGER & L);
};

//-----------------------------------------------------------------------------
// MISC FUNCTIONS

void ANotify(HWND hwnd, const char* a_Text, ...);
void WNotify(HWND hwnd, const wchar_t* a_Text, ...);
wstring GetTemporaryFile(LPCTSTR lpPrefixString);
bool IsOSXPOrLater();
bool IsOSVistaOrLater();
bool ReadTextFile(char** buffer, wstring& filename);
wstring StringToWString(const string& a_String);
string WStringToString(const wstring& a_String);
float WStringToFloat(const wstring& a_String);
int WStringToInt(const wstring& a_String);
bool WStringToBool(const wstring& a_String);
HXBlendMode WStringToBlendMode(const wstring& a_String);
wstring WStringToLowerCase(const wstring& a_String);

//-----------------------------------------------------------------------------
// MATHEMATICAL TRANFORMS

#define PI (3.141592653589793)

float TransformRoot(float position);
double TransformRoot(double position);
float TransformSqr(float position);
double TransformSqr(double position);
float TransformHalfSin(float position);
double TransformHalfSin(double position);
float TransformInvRoot(float position);
double TransformInvRoot(double position);
float TransformInvSqr(float position);
double TransformInvSqr(double position);
float TransformInvHalfSin(float position);
double TransformInvHalfSin(double position);
float TransformSin(float position);
double TransformSin(double position);
float TransformSinc(float position);
double TransformSinc(double position);

//-----------------------------------------------------------------------------
